package main

import (
	"StorageServer/final/apiServer/heartbeat"
	"StorageServer/final/apiServer/locate"
	"StorageServer/final/apiServer/objects"
	"StorageServer/final/apiServer/temp"
	"StorageServer/final/apiServer/versions"
	"log"
	"net/http"
	"os"
)

//main 代码实现的起点，处理各个请求
func main() {
	go heartbeat.ListenHeartbeat()                  //监听心跳
	http.HandleFunc("/objects/", objects.Handler)   //处理增删改查请求
	http.HandleFunc("/temp/", temp.Handler)         //断点续传
	http.HandleFunc("/locate/", locate.Handler)     //判断该选择哪个节点进行操作
	http.HandleFunc("/versions/", versions.Handler) //显示出所有版本
	log.Fatal(http.ListenAndServe(os.Getenv("LISTEN_ADDRESS"), nil))
	//LISTEN_ADDRESS=10.29.1.1:12345
}
